# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house>
pkgname=mtxclient
pkgver=0.9.2
pkgrel=8
pkgdesc="Client API library for Matrix, built on top of Boost.Asio"
url="https://github.com/nheko-reborn/mtxclient"
arch="all"
license="MIT"
depends_dev="boost-dev coeurl-dev libsodium-dev nlohmann-json olm-dev
	openssl-dev>3 re2-dev zlib-dev"
makedepends="$depends_dev cmake gtest-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/nheko-reborn/mtxclient/archive/v$pkgver/mtxclient-v$pkgver.tar.gz"
options="!check" # Requires running Synapse instance

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_LIB_EXAMPLES=OFF
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
87c9cd23ce8a52b2f850e3770eb51d03f40f4a5e45b5e536b2446932fc866b8835212d9364c5890af7404843da2547bdc94bb5d3d1933903fea8374b8900fd73  mtxclient-v0.9.2.tar.gz
"
